package org.lambda.predicate;

import java.util.function.Predicate;

public class PredicateDemo {

    public static void main(String[] args) {
        /* T：入参类型；出参类型是Boolean */
        Predicate<Integer> predicate = p -> p % 2 == 0;
        System.out.println(predicate.test(1));

        Predicate<Integer> predicate1 = p -> p % 3 == 0;
        System.out.println(predicate.and(predicate1).test(5));
        System.out.println(predicate.and(predicate1).test(6));
        System.out.println(predicate.or(predicate1).test(9));
        System.out.println(predicate.or(predicate1).test(7));
    }
}
